const mongoose = require('mongoose')

const { Schema, model } = mongoose

const answersSchema = new Schema(
  {
    __v: {
      type: Number,
      select: false
    },
    content: {
      type: String,
      required: true
    },
    answerer: {
      type: Schema.Types.ObjectId,
      ref: 'User',
      required: true,
      select: false
    },
    question_id: {
      type: String,
      required: true,
      select: true
    },
    voteCount: {
      type: Number,
      required: true,
      default: 0
    }
  },
  { timestamps: true }
)

module.exports = model('Answer', answersSchema)
